<?php
namespace app\fsadmin\controller;

use think\Controller;

class IndexController extends BaseController
{
    public function index()
    {
        return $this->fetch('index');
    }

    public function menu()
    {
        if ($this->request->isAjax()) {
            $menu_l             = model("MenuLogic", "Logic");
            $rs['data']['list'] = $menu_l->getAdminList();
            $rs['status']       = 200;
            ajax_return($rs);
        }

    }

    public function home()
    {
        if ($this->request->isAjax()) {

            $data = [
                ["id" => 1, "url" => "http://www.jqcool.net", "switch" => 1, "order" => 1, "pid" => 0, "title" => "Online Program knowledge share and study platform"],
                ["id" => 2, "url" => "http://www.baidu.com", "switch" => 0, "order" => 2, "pid" => 2, "title" => "这是测试的数数据这是测试的数数据"],
                ["id" => 3, "url" => "http://www.taobao.com", "switch" => 0, "order" => 3, "pid" => 2, "title" => "淘宝购物"],
                ["id" => 4, "url" => "http://www.jqcool.net1", "switch" => 1, "order" => 4, "pid" => 1, "title" => "Online Program knowledge share and study platform2"],
                ["id" => 5, "url" => "http://www.baidu.com1", "switch" => 0, "order" => 5, "pid" => 2, "title" => "这是测试的数数据2"],
                ["id" => 6, "url" => "http://www.taobao.com1", "switch" => 1, "order" => 6, "pid" => 1, "title" => "淘宝购物2"],
            ];
            $msg['data']['list']  = $data;
            $msg['data']['title'] = "测试数据";
            $msg['pages']         = 2;
            $msg['status']        = 200;
            //echo header("content-type:text/html; charset=utf-8");
            echo json_encode($msg);
            die;
        } else {
            return $this->fetch('home');
        }

    }
}
